import Vue from "vue"
import VueRouter from "vue-router"
import Main from '../view/main.vue'
import Index from '../view/index.vue'
import postInfo from "@/view/postInfo.vue"
import register from "@/view/register.vue"
import sendPost from "@/view/sendPost.vue"
import loginPage from "@/view/login.vue"

Vue.use(VueRouter)


const routes = [
    {
        path: '/',
        component: Main,
        redirect: '/index', //重定向
        children: [
            {path: 'index', component: Index},
            {path: 'postInfo', component: postInfo},
            {path: 'register', component: register},
            {path: 'sendPost', component: sendPost},
            {path: 'login', component: loginPage},
        ]
    }
]
const router = new VueRouter({

    mode: 'history',
    routes

})

export default router